package com.o2o.app.userCenter;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.o2o.app.R;
import com.o2o.app.userCenter.FamilyDataActivity.ClickEvent;

public class MineFamilySucceedActivity extends Activity {
	/**
	 * 家庭名字
	 */
	private TextView tv_familyname;

	/**
	 * 家庭资料按钮
	 */
	private RelativeLayout rlt_01;

	/**
	 * 添加家庭成员按钮
	 */
	private RelativeLayout rlt_02;

	/**
	 * 返回按钮
	 */
	private Button btn_back;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);

		setContentView(R.layout.mine_family_succeed);

		initViews();
		initData();
	}

	private void initViews() {
		tv_familyname = (TextView) findViewById(R.id.tv_familyname);

		rlt_01 = (RelativeLayout) findViewById(R.id.rlt_01);
		rlt_01.setOnClickListener(new ClickEvent());

		rlt_02 = (RelativeLayout) findViewById(R.id.rlt_02);
		rlt_02.setOnClickListener(new ClickEvent());

		// 返回
		btn_back = (Button) findViewById(R.id.btn_back);
		btn_back.setOnClickListener(new ClickEvent());
	}

	private void initData() {
		tv_familyname.setText("“" + getIntent().getStringExtra("name") + "”");
	}

	/**
	 * 点击事件
	 * 
	 * @author Administrator
	 * 
	 */
	class ClickEvent implements View.OnClickListener {

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			switch (v.getId()) {
			case R.id.rlt_01: { // 家庭资料按钮
				Intent intent = new Intent(MineFamilySucceedActivity.this,
						FamilyDataActivity.class);
				startActivity(intent);

			}
				break;
			case R.id.rlt_02: { // 添加家庭成员按钮
				Intent intent = new Intent(MineFamilySucceedActivity.this,
						MineAddPersonActivity.class);
				startActivity(intent);

			}
				break;

			case R.id.btn_back: {
				finish();
			}
				break;
			default:
				break;
			}
		}

	}

}
